/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-11-15
 * Time: 9:33
 */
public class Test1 {
    public String formatString (String str, char[] arg) {
        // write code here
        StringBuffer stringbuffer = new StringBuffer();
        int len = stringbuffer.length();
        String[] tmp = str.split("%s");
        int j = 0;
        for(String s : tmp) {
            stringbuffer.append(s);
            if(j < arg.length) {
                stringbuffer.append(arg[j++]);
            }
        }
        while(j < arg.length) {
            stringbuffer.append(arg[j++]);
        }
        return stringbuffer.toString();
    }
}
